I have written a dxl script to export modules in excel format. I am executing this script using a .bat file. |
Re: make DOORs run in Background instead of actually opening-up the application You can use the "-batch"-Option "C:\somewhere\doors.exe" -W -batch "C:\somewhereElse\Something.dxl" -user "MySpecialUser" -password "TopSecret" In this case you cannot use some functions which realy use specific GUI-Gimmicks. For example the doors-tool exchange does not run. Best regards Wolfgang |
Re: make DOORs run in Background instead of actually opening-up the application SystemAdmin - Fri Feb 15 03:56:06 EST 2013
Hi,
bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n" }
void infoBox (string s) {print "Info: " s "\n" }
void info (string s) {print "Info: " s "\n" }
DB theDiag = null
// Now override block and show, to only do realize
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
if (null current Module) {
print "A current module is needed for export."
halt
}
// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in excel.dxl and the other includes of it.
{
// now include the excel.dxl -> this will pop up the dialog, but not halt execution
// due to the overrides above
Module mod = current Module
load(view "Standard view")
#include <standard/export/office/excel_modified.dxl>
set(mainChoice, 4)
doExcel theDiag
saveFileAsModuleName
//closeExcel
// get rid of the dialog
if (!null theDiag) destroy theDiag
}
// close DOORS
exit_
bool saveFileAsModuleName() {
if(fileOpen) {
string filename=name(current Module)
string baseFileString = "C:\\DOORS_Auto\\" filename ".xls"
// delete the old file
deleteFile(baseFileString);
clear(args);
put(args, "FileName", baseFileString);
excelVersion = getRegistry(excelVersionKey, null);
if (excelVersion == "Excel.Application.12") { // If Excel version is 2007
put(args, "FileFormat", "56" ); // Save file as Excel 97-2003 .xls format
}
if(!checkResult(oleMethod(objWorkbook, "SaveAs", args))) {
errorBox("File SaveAs failed.");
return(false);
}
return(true);
}
errorBox("File not open");
return(false);
}
|
Re: make DOORs run in Background instead of actually opening-up the application SystemAdmin - Fri Feb 15 08:48:33 EST 2013
Hi,
bool confirm (string s) { print "Confirmed: " s "\n"; return true }
void ack (string s) {print "Acknowledge: " s "\n" }
void acknowledge (string s) {print "Acknowledge: " s "\n" }
void infoBox (string s) {print "Info: " s "\n" }
void info (string s) {print "Info: " s "\n" }
DB theDiag = null
// Now override block and show, to only do realize
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
if (null current Module) {
print "A current module is needed for export."
halt
}
// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in excel.dxl and the other includes of it.
{
// now include the excel.dxl -> this will pop up the dialog, but not halt execution
// due to the overrides above
Module mod = current Module
load(view "Standard view")
#include <standard/export/office/excel_modified.dxl>
set(mainChoice, 4)
doExcel theDiag
saveFileAsModuleName
//closeExcel
// get rid of the dialog
if (!null theDiag) destroy theDiag
}
// close DOORS
exit_
bool saveFileAsModuleName() {
if(fileOpen) {
string filename=name(current Module)
string baseFileString = "C:\\DOORS_Auto\\" filename ".xls"
// delete the old file
deleteFile(baseFileString);
clear(args);
put(args, "FileName", baseFileString);
excelVersion = getRegistry(excelVersionKey, null);
if (excelVersion == "Excel.Application.12") { // If Excel version is 2007
put(args, "FileFormat", "56" ); // Save file as Excel 97-2003 .xls format
}
if(!checkResult(oleMethod(objWorkbook, "SaveAs", args))) {
errorBox("File SaveAs failed.");
return(false);
}
return(true);
}
errorBox("File not open");
return(false);
}
There is no GUI loaded in batch mode, so you cannot use dialog boxes. Your batch code will have to know what to do exactly; no doubt coding which module you want to export, opening it, exporting, closeing and exiting.
better yet, load the standard view:
db = create("Export")
set DBEs
apply(db, "Export", applyDoTheWork)
if (batchMode()) //
then applyDoTheWork(db) // the primary callback
else {realize(db); show(db)}
|
Re: make DOORs run in Background instead of actually opening-up the application llandale - Fri Feb 15 14:07:04 EST 2013
There is no GUI loaded in batch mode, so you cannot use dialog boxes. Your batch code will have to know what to do exactly; no doubt coding which module you want to export, opening it, exporting, closeing and exiting.
better yet, load the standard view:
db = create("Export")
set DBEs
apply(db, "Export", applyDoTheWork)
if (batchMode()) //
then applyDoTheWork(db) // the primary callback
else {realize(db); show(db)}
Doors has the perm isBatch() to detect this state. Best regards Wolfgang |